package cn.cloudplug.instar_ec.main.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by pc on 2018/1/31.
 */

public abstract class StatusBarDelegate<T extends BaseProvider> extends InstarDelegate {
    private T provider;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=super.onCreateView(inflater, container, savedInstanceState);
        if(provider!=null)provider.onDelegateBindView();
        return view;
    }

    protected T getProvider(){
        return provider;
    }


    protected  void setProvider(T provider){
        this.provider=provider;
    }


    @Override
    protected Object setContent() {
        return setLayout();
    }


    protected abstract Object setLayout();

    @Override
    public void onDestroy() {
        if(provider!=null)provider.onDelegateDestroy();
        super.onDestroy();
    }
}
